import request from '../utils/request'


/*获取所有的商品分类*/ 
export function getCategories(params){
  return request({
    method:'get',
    url:'categories',
    params
  })
}

/*根据id查询分类*/
export function getCategoryById(id){
  return request({
    method:'get',
    url:'categories/'+id
  })
}

/*添加商品分类*/
export function addCategory(data){
  return request({
    method:'post',
    url:'categories',
    data
  })
}

/*修改商品分类*/
export function updateCategory(id,data){
  return request({
    method:'put',
    url:'categories/'+id,
    data
  })
}

/*根据id删除分类*/
export function deleteCategoryById(id){
  return request({
    method:'delete',
    url:'categories/'+id
  })
}
